package com.frxuexi.cart.adapter

import androidx.databinding.DataBindingUtil
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.frxuexi.cart.R
import com.frxuexi.cart.databinding.ItemAddressBinding
import com.frxuexi.lib_base.entity.AddressBeanItem

class AddressAdapter:BaseQuickAdapter<AddressBeanItem,BaseViewHolder>(R.layout.item_address) {
    override fun onItemViewHolderCreated(viewHolder: BaseViewHolder, viewType: Int) {
        super.onItemViewHolderCreated(viewHolder, viewType)
        DataBindingUtil.bind<ItemAddressBinding>(viewHolder.itemView)
    }
    override fun convert(helper: BaseViewHolder, item: AddressBeanItem) {
        val binding = DataBindingUtil.getBinding<ItemAddressBinding>(helper.itemView)!!
        binding.bean=item

        var city="收获地址：${if(item.province==item.city) item.province else item.province+item.city}${item.district}${item.detail}"
        binding.conAddress.setText(city)

    }
}